import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/ruoyi";


//
export const dadeService = {
    list(query) {
        return request({
            url: "/api/dadeindx/list",
            method: "get",
            params: query,
        });
    },
    get(id){
        return request({
            url: `/api/dadeindx/get/${id}`,
            method: "get",
            params: {},
        });
    }

    
};

//
export const dictitemService = {
    list(query) {
        return request({
            url: "/api/dictitem/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/dictitem/save-or-update`,
            method: "post",
            data,
        });
    },
    postStateChange(data) {
        return request({
            url: `/api/dictitem/change-state/${data.id}`,
            method: "post",
            params: data,
        });
    },
};
//
export const dictService = {
    list(query) {
        return request({
            url: "/api/dict/list",
            method: "get",
            params: query,
        });
    },
    all(query) {
        return request({
            url: "/api/dict/all",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/dict/save-or-update`,
            method: "post",
            data,
        });
    },
};
//
export const confgService = {
    list(query) {
        return request({
            url: "/api/confg/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/confg/save-or-update`,
            method: "post",
            data,
        });
    },

};


//
export const noticeService = {
    list(query) {
        return request({
            url: "/api/notice/list",
            method: "get",
            params: query,
        });
    },

    listHome(query) {
        return request({
            url: "/api/notice/list-home",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/notice/save-or-update`,
            method: "post",
            data,
        });
    },
    postChangeState(data) {
        return request({
            url: `/api/notice/change-state/${data.id}`,
            method: "post",
            data,
        });
    },

};


//
export const archiveeService = {
    list(query) {
        return request({
            url: "/api/archivee/list",
            method: "get",
            params: query,
        });
    },
    listDocument(query) {
        return request({
            url: "/api/archivee/list-document",
            method: "get",
            params: query,
        });
    },
    listAttachment(query) {
        return request({
            url: "/api/archivee/list-attachment",
            method: "get",
            params: query,
        });
    },

    listPhoto(query) {
        return request({
            url: "/api/archivee/list-photo",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/archivee/save-or-update`,
            method: "post",
            data,
        });
    },

    postUploadPhoto(data, archiveeId) {
        return request({
            url: `/api/archivee/upload-photo/${archiveeId}`,
            method: "post",
            headers: {
                "Content-Type": "multipart/form-data",
            },
            data,
        });
    },
    postUpload(data, archiveeId) {
        return request({
            url: `/api/archivee/upload-attach/${archiveeId}`,
            method: "post",
            headers: {
                "Content-Type": "multipart/form-data",
            },
            data,
        });
    },
    postDocumentSave(data) {
        return request({
            url: `/api/archivee/document/save`,
            method: "post",
            data,
        });
    },
};

//
export const menuService = {
    list(query) {
        return request({
            url: "/api/menu/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/menu/save-or-update`,
            method: "post",
            data,
        });
    },
};

//
export const userService = {
    list(query) {
        return request({
            url: "/api/user/list",
            method: "get",
            params: query,
        });
    },
    postResetpwd(data) {
        return request({
            url: `/api/user/resetpwd/${data.id}`,
            method: "post",
            params: data,
        });
    },
    postStateChange(data) {
        return request({
            url: `/api/user/state/${data.id}`,
            method: "post",
            params: data,
        });
    },
    postSave(data) {
        return request({
            url: `/api/user/save-or-update`,
            method: "post",
            data,
        });
    },
};

//
export const roleService = {
    list(query) {
        return request({
            url: "/api/role/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/role/save-or-update`,
            method: "post",
            data,
        });
    },
    getMenusByRoleId(roleId) {
        return request({
            url: `/api/role/menus/${roleId}`,
            method: "get",
            // params: query,
        });
    },

    postSavemenus(roleId, data) {
        return request({
            url: `/api/role/menus/${roleId}`,
            method: "post",
            data,
        });
    },
};


//
export const attachmentService = {

    postUpload(data) {

        return request({
            url: `/api/attachment/upload`,
            method: "post",
            headers: {
                "Content-Type": "multipart/form-data",
            },
            data,
        });
    },

};
